package org.example.sprojcet.controller;

import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.example.sprojcet.entitys.Book;
import org.example.sprojcet.entitys.User;
import org.example.sprojcet.mapper.BookMapper;
import org.example.sprojcet.mapper.UserMapper;
import org.example.sprojcet.service.BookService;
import org.example.sprojcet.utils.FilesUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.ArrayList;
import java.util.Map;

@RestController
@RequestMapping("/book")
@RequiredArgsConstructor
public class BookController {

    @Autowired
    private BookService bookService;

    @PostMapping("savaBook") // 访问路径将是 /api/book/savaBook
    public SaResult savaBook(@RequestPart("file") MultipartFile[] files, @RequestPart Book book) {
        return bookService.savaBook(files, book);
    }
}
